{
  LW Objrep -- LightWave Object Replacement

  Object replacement handlers are called at each time step to decide whether
  Layout should use a different object file to represent an object.
  An object's geometry might be replaced depending on its camera distance
  (level of detail replacement), or a time (object sequence loading),
  or some other criterion (previewing versus rendering, for example).

  Based on lwobjrep.h which is:
  Copyright 1999, NewTek, Inc.
}

{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}

unit LW_Objrep;

{$mode objfpc}{$H+}

interface

uses
  LW_Types   ,
  LW_Handler ,
  LW_Render  ,
  LW_CmdSeq  ;

const
  LWOBJREPLACEMENT_HCLASS  = 'ObjReplacementHandler'   ;
  LWOBJREPLACEMENT_ICLASS  = 'ObjReplacementInterface' ;
  LWOBJREPLACEMENT_GCLASS  = 'ObjReplacementGizmo'     ;
  LWOBJREPLACEMENT_VERSION = 4 ;

  LWOBJREP_NONE	       = 0 ;
  LWOBJREP_PREVIEW     = 1 ;
  LWOBJREP_RENDER      = 2 ;
  LWOBJREP_INTERACTIVE = 3 ;

type
  PLWObjReplacementAccess = ^TLWObjReplacementAccess ;
  TLWObjReplacementAccess = record
    ObjectID              : PLWItem  ;
    CurFrame              ,
    NewFrame              : TLWFrame ;
    CurTime               ,
    NewTime               : TLWTime  ;
    CurType               ,
    NewType               : Integer  ;
    CurFilename           ,
    NewFilename           : PChar    ; // const
    Force                 : Integer  ;

    { Providing a modeling callback routine allows mesh manipulation
      right after full object replacement.
      This routine is only valid once after it has been specified.
      return 1 if the mesh was edited, else 0.
      The primary foreground layer is the mesh of the object being replaced.
      There are no background layers.                                         }
    EditMesh    : function
                  (  ModelingCommand : PLWModCommand ) : Integer ;
  end;

  PLWObjReplacementHandler = ^TLWObjReplacementHandler ;
  TLWObjReplacementHandler = record
    Inst        : PLWInstanceFuncs;
    Item        : PLWItemFuncs    ;
    Evaluate    : procedure
                  (      Instance : PLWInstance             ;
                   const Access   : PLWObjReplacementAccess ) ;
  end;

implementation

end.

